package com.woniuxy.common.mapper;

import com.woniuxy.common.entity.MarketOrder;
import com.woniuxy.common.entity.MarketOrderExample;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface MarketOrderMapper {
    long countByExample(MarketOrderExample example);

    int deleteByExample(MarketOrderExample example);

    int deleteByPrimaryKey(String id);

    int insert(MarketOrder record);

    int insertSelective(MarketOrder record);

    List<MarketOrder> selectByExample(MarketOrderExample example);

    MarketOrder selectByPrimaryKey(String id);

    int updateByExampleSelective(@Param("record") MarketOrder record, @Param("example") MarketOrderExample example);

    int updateByExample(@Param("record") MarketOrder record, @Param("example") MarketOrderExample example);

    int updateByPrimaryKeySelective(MarketOrder record);

    int updateByPrimaryKey(MarketOrder record);

    @Select("select * from market_order where senduser_id = #{senduserid} order By date DESC")
    List<MarketOrder> selectISellOrder(String senduserid);

    @Select("select * from market_order where buyuser_id = #{buyuserid} order By date DESC")
    List<MarketOrder> selectIBuyOrder(String buyuserid);

    @Update("update market_order set status=1 where id=#{orderId}")
    int updatePayStatusById(String orderId);

    @Update("update market_order set status=2 where id=#{orderId}")
    int updateSignStatusById(String orderId);

    @Update("update market_order set status=3 where id=#{orderId}")
    int updateAppraiseStatusById(String orderId);
}